package cn.cttic.link.controller;

import cn.cttic.common.core.domain.R;
import cn.hutool.core.lang.Assert;
import lombok.extern.slf4j.Slf4j;
import org.dromara.sms4j.api.SmsBlend;
import org.dromara.sms4j.api.entity.SmsResponse;
import org.dromara.sms4j.core.factory.SmsFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping
public class ThirdSmsTestController {

    private static final String CUSTOMIZE = "iHuyi";

    @GetMapping("/testSMS")
    public R<?> testSMS() {

        System.out.println("------------");
        SmsBlend smsBlend = SmsFactory.getBySupplier(CUSTOMIZE);
        SmsResponse smsResponse = smsBlend.sendMessage("13321160702", "802000");
        Assert.isTrue(smsResponse.isSuccess());
        System.out.println(smsResponse.getData());

        return R.ok();
    }
}
